package com.yycwxt.modules.admin.bcf;

import com.yycwxt.domain.Bcf;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Mr.Zhang on 2022/9/2 16:09
 */
@Service
public class BcfService {

    private final BcfMapper bcfMapper;

    public BcfService (@Autowired BcfMapper bcfMapper) {
        this.bcfMapper = bcfMapper;
    }

    // 按照账期查询全部
    public List<Map<String, Object>> selectBcf(int zq) {
        Map<String, Object> map = new HashMap<>();
        map.put("zq", zq);
        map.put("storeNames", new String [] {"金社长仓库", "金社长二仓", "金社长返货仓", "沈北wms", "湖南仓", "天下云仓", "代发仓库"});
        return bcfMapper.selectBcf(map);
    }

    // 使用存储过程插入数据
    @Transactional
    public void generateBcf(int zq) {
        bcfMapper.generateBcf(zq);
    }

    // 查询账期
    public Object[] selectZq() {
        return bcfMapper.selectZq();
    }

    // 下载源文件
    public List<String> getUrl(){
        return bcfMapper.getUrl();
    }
}
